package abstract1;

abstract class Shape{
    public abstract void draw();
    public void func(){
        System.out.println("s");
    }
}
class Circle extends Shape{
    @Override
    public void draw(){
        //super.func();//1.通过super调用父类的方法
        System.out.println("○");
    }
}
class Rect extends Shape{
    @Override
    public void draw(){
        System.out.println("□");
    }
}
class Flower extends Shape{
    @Override
    public void draw(){
        System.out.println("❀");
    }
}
public class TestDemo {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        drawMap(new Circle());
        drawMap(new Rect());
        drawMap(new Flower());
        //2.可以向上转型，通过实例化子类来调用
        Shape shape=new Rect();
        shape.func();
    }
}
